package com.leetcode.LC;

import java.util.ArrayList;
import java.util.List;

public class LC401 {

    public List<String> readBinaryWatch(int num) {

        List<String> list = new ArrayList<>();
        if (num==0){
            list.add("0:00");
            return list;
        }
        for (int i = 0; i <12 ; i++) {
            for (int j = 0; j <60 ; j++) {
                if (oneNum(i)+oneNum(j)==num){
                    list.add(i+":"+(j<10?("0"+j):j));
                }
            }
        }

        return list;
    }

    public int oneNum(int num) {
        int count = 0;
        while (num >= 1) {
            if (num % 2 == 1) {
                count++;
            }
            num /= 2;
        }

        return count;
    }

    public static void main(String[] args) {
        for (String watch : new LC401().readBinaryWatch(1)) {
            System.out.print(watch+",");
        }
        System.out.println();
        System.out.println(new LC401().oneNum(0));
    }
}
